package leetcode

func getRow(rowIndex int) []int {
	if rowIndex < 0 {
		return nil
	}

	if rowIndex == 0 {
		return []int{1}
	}

	row := make([]int, rowIndex+1)
	var i, j int

	row[0] = 1
	for i = 1; i <= rowIndex; i++ {
		for j = i; j > 0; j-- {
			row[j] += row[j-1]
		}
	}
	return row
}
